<?php
$selected_region_setting = array(
    'table_name' => 'animus_sub_region',
    'key_field' => 'id',
    'value_field' => 'name',
    'init_data'=>array('key'=>'','name'=>'(Select region)')
);
$selected_region = isset($selected_region)?$selected_region:"";
?>

<div id="wrapper-content" >
    <table class="titrepage" width="100%">
        <tr>
            <td >La liste des promenades</td>
            <td align="right">Total | <?php echo $total ?> </td>
        </tr>
    </table>
    <?php echo form_open('doggy_admin/search_parkway'); ?>
    <div align="left" id="ajouter" >
        <table width="100%">
            <tr>
                <td><a href="<?php echo site_url('doggy_admin/add_parkway') ?>">Ajouter nouveau promenade</a></td>
                <td align="right">Input region:<?php echo form_dropdown('search_region',dropdown_data($selected_region_setting),$selected_region,'style="width:150px;"')?><input type="submit" name="search" value="Search" /></td>

           </tr>
        </table>
    </div>
    <?php echo form_close(); ?>
    <?php if($total>0){?>
    <table align="center" width="100%" class="list">
        <thead>
            <tr>
                <th>Image</th>
                <th>Région</th>
                <th>Nom du parc</th>
                <th>Description</th>
                <th colspan="2">Action</th>
            </tr>
        </thead>
        <?php foreach ($query as $aRow): ?>
        <?php
                $image_path = './assets/parkway/images/' . $aRow['image'];
                if ($aRow['image'] != '') {
                    if (file_exists($image_path)) {
                        $image_path = base_url().'/assets/parkway/images/' . $aRow['image'];
                    } else {
                        $image_path = root_url('doggy-flirt').'doggy_avatar/noimage.gif';
                    }
                } else {
                    $image_path = root_url('doggy-flirt').'assets/noimage.gif';
                }
        ?>
                <tr>
                    <td><img src="<?php echo $image_path;?>" height="60"/></td>
                    <td><?php echo $aRow['region']; ?></td>
                    <td><?php echo $aRow['name']; ?></td>
                    <td><?php echo get_short_description($aRow['description'],20); ?></td>
                    <td width="70px"><a  href="<?php echo site_url('doggy_admin/edit_parkway') . '/' . $aRow['id']; ?>" ><img border="0"src="<?php echo root_url('doggy-flirt') . 'assets/admin/' ?>images/modifier.png"/></a></td>
                    <td width="70px">
                        <a class="supprimer" href="#" ><img border="0"src="<?php echo root_url('doggy-flirt') . 'assets/admin/' ?>images/supprimer.png"/></a>
                        <div style="display:none">
                    		    	Confirmer <br/>
                        <a href="<?php echo site_url('doggy_admin/delete_parkway') . '/' . $aRow['id'] . '/' . $per_page . '/' . $off_set; ?>"> <img border="0"src="<?php echo root_url('doggy-flirt') . 'assets/admin/' ?>images/oui.png"/></a>
                        <a class="non" href="#" ><img  border="0"src="<?php echo root_url('doggy-flirt') . 'assets/admin/' ?>images/non.png"/></a>
                        </div>
                    </td>
                </tr>
        <?php endforeach; ?>
            </table>
    <?php echo $pagination; ?>
    <?php }else{?>
    <h3>Not found!</h3>
    <?php }?>
</div>
<!--END wrapper-content-->
